package com.wehiking.webviewKotlin

import java.util.ArrayList

import android.support.v4.view.PagerAdapter
import android.view.View
import android.view.ViewGroup

class MyPagerAdapter(views: ArrayList<View>) : PagerAdapter() {

    private var views = ArrayList<View>()

    init {
        this.views = views
    }

    override fun getCount(): Int {
        return views.size
    }

    override fun isViewFromObject(arg0: View, arg1: Any): Boolean {
        return arg0 === arg1
    }

    override fun destroyItem(container: ViewGroup, position: Int, `object`: Any) {
        container.removeView(views[position])
    }

    override fun instantiateItem(container: ViewGroup, position: Int): Any {
        val view = views[position]
        container.addView(view)
        return view
    }

}
